This invention relates to the production and display of interlaced video images. A method and apparatus for scaling interlaced video images is disclosed.
Most known display devices, including cathode ray tubes (`CRTs`) and liquid crystal displays (`LCDs`), have picture elements which must be refreshed every few moments to prevent image flickering and the consequent loss of the image. A common method to prevent this flickering and loss of picture, which has been in use for many decades, is to interlace the video data. As shown in FIG. 1, video data is stored and/or transmitted sequentially in two fields, the first field containing all the data for the even display lines and the second field containing all the data for the odd display lines. For purposes of this description, the first line of the display will be line 0 and it is even. This designation is arbitrary and can be changed without in any way altering the substance of the invention. In operation, all the data for the even numbered lines contained in the first field is displayed first, followed by all the data for the odd-numbered lines contained in the second field. Using this alternation of even and odd fields results in adjacent picture elements being refreshed often enough to prevent or to minimize the effects of the fading or "flickering" of the individual picture elements. This technique is commonly called interlacing.
Although interlacing video data produces acceptable picture quality with relatively inexpensive components, it is not without problems. In particular, scaling the video data to produce scaled video images presents several difficulties. In this description, scaling includes both the enlargement or shrinkage of the image. In order to scale down or reduce the image, a certain number of input pixels must be mapped to a smaller number of output pixels. This can be done by either discarding some pixels according to the difference in the size of the input image and the desired output image or performing a weighted arithmetic averaging to reduce the total number of pixels. Obviously, using either technique requires the knowledge of which pixels are to be dropped or combined by averaging.
As the shape of the output image can be any rectangular shape (with or without the same aspect ratio as the input window), the scaling factor must be applied independently in both the vertical (`Y`) and horizontal (`X`) direction. Also, it is desirable to be able to scale the image independently in both the X and Y directions.
A simple way of shrinking an image is to drop some pixels. To improve the quality of the image so produced, the pixels should be dropped uniformly across the input image. For example, the determination as to whether a pixel in the X-direction is to be dropped can be made by having a simple counter that generates a periodic pulse by dividing the input pixel rate (pixel clock) by a variable scaling factor. With a programmable divider, the image can be scaled in the X-direction by any desired factor.
To scale the image in a vertical direction, some lines of the image will have to be skipped entirely. This can be done by dividing the line rate by the vertical scale factor and using the output of the division operation to determine if the next line should be dropped. Circuits to perform both the horizontal and vertical divisions have been known and used for many years.
The scaling process can be done at several different times. In one method, the entire image is stored in a frame buffer. The image is then selectively copied, using the horizontal and vertical divisions, into a second frame buffer. Although this process works, it is slow. Also, as parts of the image which will not be displayed are stored, albeit temporarily, a system using this process requires extra memory and is more expensive. A better method is to perform the scaling process as the image is placed in the frame buffer. This method is particularly attractive as almost all images are generated by a raster scan process.
In a raster scan process, the image is broken down horizontally and vertically and transmitted to the buffer in serial fashion. To scale the image, each pixel as it reaches the frame buffer is either stored and the frame buffer address pointer incremented, or the pixel is ignored and the frame buffer address pointer remains the same.
As discussed, many images are produced using an interlaced data format. The simple scaling techniques mentioned previously, when used on interlaced video data, can result in either the dropping of adjacent lines or the display of lines in an inappropriate order.
FIG. 2 shows how the 50% scaling of an interlaced image having two fields can result in an undesired granularity in the final image. With 50% scaling, every other line in each field is discarded. When the beginning of the second odd field is detected, the scaling counter is reset and the first and successive, alternating lines from that field are displayed. The result is that lines 0,1,4,5,8 and 9 are displayed. Thus, lines 2 and 3 and lines 6 and 7 are discarded. With two successive lines missing, the output image appears to have annoying discontinuities.
In the special case of reducing the image by 50%, a known technique which works well is to discard all the information contained in either the first or second field. Although the technique works well in the special case of 50% reduction, it obviously cannot be used with other scaling factors. Consequently, the machine performing the scaling will need to store at least two algorithms: a first for the special case of 50% reduction and a second for other scaling requirements.
One attempt to correct the noted discontinuities requires that the scaling counter not be reset when moving from the first to second field. As shown in FIG. 3, when a two field image of 16 total lines is scaled by 2/3, this technique results in three pairs of lines (3/2, 9/8, 15/14) being displayed in the wrong order. Output of this type is also undesirable.
In general, known scaling methods for interlaced data only function well when the scaling factor is a binary factor (e.g. 50%, 25%, 12.5%, etc.) of the original image. The use of non-binary scaling factors with known scaling methods results in discontinuities and misplaced display lines.